<?php
if (!defined('baseinfo')) {
    exitdata();
}   
?>

<div class="wrprAddCtnt">
    <form id="formaddfeature">
    
    <div id="pageaddfeature1">
    <div class="wrpAddCtnt clBg4 clBd2 bdFull">
    
    <?if($data['nowfeature']['isinfo']=='1')
    {?>
    <div class="stepInfoStant">
            <input type="button" onclick="stepdata(1)" value="Step 1. Create Title" class="btnStpInf clTxtW clBgBt1 fs04 clBgSp2">
            <input type="button" onclick="stepdata(2)" value="Step 2. Create Content" class="btnStpInf clTxtW clBgBt1 fs04">
            <input type="button" onclick="stepdata(3)" value="Step 3. Select Theme" class="btnStpInf clTxtW clBgBt1 fs04">
        </div>
    <?}?>
        <div class="wrpStaticAddCtnt clBd2 bdBtm" id="firstaddform">
            <div class="itPlg">
                <!--<form class="wrpTtlDesAddCtnt">-->
                    <fieldset class="frmTtlDesAddCtnt">
                        <div class="ttlAddCtnt fs04 clTxt2">
                            <label>Title</label><br>
                            <input type="text" value="<?=$data['product']['title']?>" name="title" class="inpAddCtnt w630 clBg5 clBd2 fs03 clTxt2">
                        </div>
                        <div class="desAddCtnt fs04 clTxt2">
                            <label>Description</label><br>
                            <textarea name="description" class="inpAddCtnt w630 clBg5 clBd2 fs03 clTxt2"><?=$data['product']['description']?></textarea>
                        </div>
                    </fieldset>
                <!--</form>-->
            </div>

            
        </div>
        <div id="addform" class="wrpDynamicAddCtnt clearfix">
   
        </div>
    </div>
    <!--################## landing infomation ##################-->
    <div class="wrpAddInfoLd">
               
            <fieldset class="wrpInAddInfoLd">
                <div class="wrpTnAddInfoLd" id="lastaddform">

                </div>
                <div class="wrpCatAddInfoLd">
                    <div class="wrpTtlAddGen">
                        <h2 class="ttlAddGen clTxt2 fs03">Catergories</h2>
                        <p class="rcmAddGen clTxt3 fs01">more than 1 is ok.</p> 
                    </div>
                    <div class="wrpCatArea clBg4 clBd2 fs03 clTxt3 bdFull">

                        
                        
                        <?if(count($data['tag'])){

                        $rowCat=1;
    foreach($data['tag'] as $keytag=> $valuetag)
    {
    $checkdata="";
    if(count($data['product']['tag']))
    {
    $searchdata=array();
    $searchdata['name']=$valuetag;
    $searchdata['system']=1;
    $searchdata['tagid']=intval($keytag);
    
    
//                        echo "<pre>";
//                        print_r($data['product']['tag']);
//                        echo "</pre>;";
//                        
//                        echo "<pre>";
//                        print_r($searchdata);
//                        echo "</pre>;";

    if (in_array($searchdata, $data['product']['tag'])) {
    $checkdata='checked="checked"';
    }
    }
    ?>
    <div class="wrpInCatArea">
    <input type="checkbox" <?=$checkdata?>  class="checkBoxDm" value="<?=$valuetag?>" name="tagsystem[]" id="slctCat<?=$rowCat?>">
    <label for="slctCat<?=$rowCat?>"><?=$valuetag?> </label>
    </div>

<? 
   $rowCat++;
}

}?>
                        
                        
                    </div>
                </div>
                <div class="wrpTagPlshAddInfoLd">
                    <div class="wrpTagArea mgBtm10">
                        <div class="wrpTtlAddGen">
                            <h2 class="ttlAddGen clTxt2 fs03">Tags</h2>
                            <p class="rcmAddGen clTxt3 fs01">use # for seperate</p> 
                        </div>
                        <?
                        $strtag="";
                        if(count($data['product']['tag']))
                        {
                        foreach($data['product']['tag'] as $valuetagproduct)
                        {
                        
                        if($valuetagproduct['system']==0) 
                        {
                        $strtag.="#".$valuetagproduct['name']." ";
                        
                        }
                        
                        
                        }
                        
                        }else
                        {
                        $strtag="#".$_COOKIE['displayname'];
                        
                        }
                        
                        ?>
                        <input name="taguser[]" maxlength="120" value="<?=$strtag?>" class="inpAddCtnt inpTagAdd clBg4 clBd2 fs03 clTxt2 insertTagdata" placeholder="ex: #shopping#sale#bangkok">
                        
                        <div class="wrpBtnInpTag">
                            <div class="clBd2 bdFull btnInpTag clBg4" onclick="getaddusertagdata();$('.popInpTag').toggle();">
                                <span class="ico icoArwDwnInpTag"></span>
                            </div>
                            <div class="popInpTag clBg5 clBd2 bdFull" style="display: none;">
                                
                             <!--   <div class="lstInpTag clBd2 bdBtm clearfix">
                                    <span class="txtLstInpTag cutTxt fs03 clTxt2">#TAG#TAG#TAG#TAG#TAG#TAG#TAG#TAG#TAG#TAG#TAG</span>
                                    <span class="icoLstInpTag ico icoDelTag"></span>
                                </div>
                                <div class="lstInpTag clBd2 bdBtm clearfix">
                                    <span class="txtLstInpTag cutTxt fs03 clTxt2">#TAG</span>
                                    <span class="icoLstInpTag ico icoDelTag"></span>
                                </div>-->
                            </div>
                        </div>
                        
                    </div>
                    
                    <?
                    $displaydata="display: none;";
                    $codecheck='';
                    if($data['code']==1)
                    {
                    $displaydata="";
                    $codecheck=$data['product']['code'];
                    
                    }
                    ?>
                    <div class="wrpCodeArea" style="<?=$displaydata?>">
                        <div class="wrpTtlAddGen">
                            <h2 class="ttlAddGen clTxt2 fs03">Code</h2>
                            <p class="rcmAddGen clTxt3 fs01">for security</p> 
                        </div>
                        <input type="text" name="code" placeholder="" value="<?=$codecheck?>" class="inpAddCtnt inpTagAdd clBg4 clBd2 fs03 clTxt2">
                    </div>
                    
                    <div class="wrpPlshArea">
                        <div class="wrpTtlPlshAddInfoLd">
                            <h2 class="ttlPlshAddInfoLd clTxt2 fs03">Publish</h2>
                            <p class="rcmPlshAddInfoLd clTxt3 fs01">Who can see this?</p> 
                        </div>
                        <div class="wrpPlsh">
                            <?
                            $status1="checked";
                            $status2="";
                            if($data['product']['status']==2)
                            {
                            $status2="checked";
                            $status1="";
                            
                            }
                            
                            ?>
                        
                            <input type="radio" value="1" name="status[]" value="EveryOne" id="everyOne" <?=$status1?>>
                            <label for="everyOne" class="fs03 clTxt3">Everyone</label>
                            <input type="radio" value="2" name="status[]" value="OnlyMe" id="onlyMe" <?=$status2?>>
                            <label for="onlyMe" class="fs03 clTxt3">Only Me</label>
                            
                            
                        </div>
                    </div>
                </div>
            </fieldset>

    </div>
    </div>
     
     <?

     if($data['nowfeature']['pageall'])
     {

     $numvalue=intval($data['nowfeature']['pageall']);
     for($i=2;$i<=$numvalue;$i++)
     {
     ?>
     
      <div id="pageaddfeature<?=$i?>" style="display: none;">
      
      </div>
     <?
     
     
     
     }
     
     
     }
     
     ?>
   
     <div class="ftrAddCtnt">
        <div class="wrpAuthUpdtAddCtnt">
            <div class="authAddCtnt clTxt3 fs02">
                <span class="boldGen">By</span>
                <span><?=$_COOKIE['displayname']?></span>
            </div>
            <div class="updtAddCtnt clTxt3 fs02">
                <span class="boldGen">Updated</span>
                <span><?=date("d/m/Y")?></span>
            </div>
        </div>
        <div class="wrpBtnAddCtnt">
            <input type="hidden" name="fid" value="<?=$data['fid']?>"><input type="hidden" name="infoid" value="<?=infoid?>">
            <input type="hidden" name="productid" value="<?=$data['product']['productid']?>">
            <input type="hidden" name="ispoi" value="<?=$data['ispoi']?>">

            <?if($data['nowfeature']['pageall']){?>
            <input type="button" value="Back" class="btnGen clTxtW cutTxt clBgBt1 fs04 btnBack backBtn" style="display: none;">
            <?}?>
            <input type="button" class="btnGen clTxtW cutTxt clBgSp2 fs04 nextBtn" <?if(!$data['nowfeature']['pageall']){?> id="btnsubmit" <?}?> value="<?if($data['nowfeature']['pageall']){ echo "Next";  } else if($data['product']['productid']){?>Save<?}else{ echo "Add";}?>">
            <!-- delete button appear when edit only -->
            <? if($data['product']['productid']){?>
            <input type="button" class="btnGen clTxtW cutTxt clBgBt1 fs04" onclick="deleteproduct(<?=$data['product']['productid']?>,1)" value="Delete">
            <?}?>
        </div>  
    </div> 
    
       
    </form>
</div>









